package gov.sat.tax.fwsk.wlrz;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;


/***
 * 解密认证结果
 * @author weitao
 *
 */

public class JM_RZJGServlet extends HttpServlet {
	private Logger log = Logger.getLogger(getClass());
	public static String jmip = "83.16.18.155";

	public void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

			String mw = request.getParameter("mw");
			log.debug(mw);
			if(null == mw || "".equals(mw.trim())){
				log.debug("密文参数为空");
				response.setContentType("text/html; charset=gb2312");
				PrintWriter out = response.getWriter();
				out.println("-100");
				return;
			}
			List rtn = new  JmHandler().doJmProc_Jms(mw, jmip, true);
			response.setContentType("text/html; charset=gb2312");
			PrintWriter out = response.getWriter();
			if(null != rtn){
				for(int i=0;i<rtn.size();i++){
					log.debug(rtn.get(i));
					out.println(rtn.get(i)+"\n");
				}
			}else{
				log.debug("解密失败");
				out.println("-100");
			}
			
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	 
}